package com.strategy;

public class CashContext {
    private CashSuper cs;
    public CashContext(String type){
        switch (type){
            //不打折
            case "正常收费":
                cs = new CashNormal();
                break;
            case "满300-30":
                cs = new CashReturn("300","30");
                break;
            case "满八折":
                cs = new CashRebate("0.8");;
                break;
            default:
                throw new IllegalStateException("Unexpected value: " + type);
        }

    }
    public double getResult(double money){
        return cs.acceptCash(money);
    }
}
